(function(){function e(e){this.config=e;this.id=this.config.id;this.searchIndex=[];this._searchResult=[];this._searchResultSect=[];this._searchResultLabel=[];this.paramsCache={};this.Init()}e.prototype={Init:function(){var e=this;window.__bxResult=window.__bxResult||{};this.params={};BX.addCustomEvent(this,"OnComponentParamsDisplay",function(t){e.params=t;e.GetComponentParams(t)});BX.addCustomEvent(this,"OnComponentParamsResize",function(t,a){e.Resize(t,a)})},GetComponentParams:function(e){var t=this,a=this.GetCachedParams(e);if(!e.relPath&&this.config.relPath)e.relPath=this.config.relPath;if(a){h(a)}else{var r={},s,p,i;for(p in e.currentValues){if(e.currentValues.hasOwnProperty(p)){s=e.currentValues[p];if(typeof s=="string"&&s==="undefined")r[p]="";else if(typeof s=="string"&&s.substr(0,8).toLowerCase()=="={array(")r[p]=this.GetArray(s.substr(2,s.length-3));else r[p]=e.currentValues[p];if(typeof r[p]=="object"){for(i=0;i<r[p].length;i++){if(r[p][i]==="undefined"||r[p][i]===undefined)r[p][i]=""}}}}var o=this.config.requestUrl,n=Math.round(Math.random()*1e6),l={component_params_manager:n,sessid:BX.bitrix_sessid(),site_template:e.siteTemplate||"",site:e.siteId||BX.message("SITE_ID"),component_name:e.name,component_template:e.template,current_values:r};window.__bxResult[n]=null;BX.ajax.post(o,l,function(){setTimeout(function(){h(window.__bxResult[n]);t.SetCachedParams(e,window.__bxResult[n])},100)})}function h(a){var r=t.BuildComponentParams(a,e);BX.adminFormTools.modifyFormElements(r);if(e.callback&&typeof e.callback=="function"){e.callback({},r)}}},LoadComponentParams:function(e){var t=this.GetCachedParams(e);if(t){if(e.callback&&typeof e.callback=="function"){e.callback()}}else{var a=this,r=this.config.requestUrl,s=Math.round(Math.random()*1e6),p={component_params_manager:s,sessid:BX.bitrix_sessid(),site_template:e.siteTemplate||"",component_name:e.name,component_template:e.template,current_values:e.currentValues};window.__bxResult[s]=null;BX.ajax.post(r,p,function(){setTimeout(function(){a.SetCachedParams(e,window.__bxResult[s])},10)})}},GetCachedParams:function(e){if(this.IsEmpty(e.currentValues)&&this.paramsCache[e.name]&&this.paramsCache[e.name][this.GetCacheId(e)]){return this.paramsCache[e.name][this.GetCacheId(e)]}else{return false}},SetCachedParams:function(e,t){if(!this.paramsCache[e.name]){this.paramsCache[e.name]={}}if(this.IsEmpty(e.currentValues)){this.paramsCache[e.name][this.GetCacheId(e)]=t}},GetCacheId:function(e){return e.name+"|"+e.siteTemplate+"|"+e.template},IsEmpty:function(e){for(var t in e){if(e.hasOwnProperty(t)){return false}}return true},BuildComponentParams:function(e,t){var a=t.container,r=this,s,p,i,o,n;this.paramsIndex={};this.groupIndex={};if(!e.groupIndex)e.groupIndex={};this.searchIndex=[];BX.cleanNode(a);BX.addClass(a,"bxcompprop-wrap");var l=BX.GetWindowScrollPos();this.pContainer=a;this.pLeftSide=a.appendChild(BX.create("DIV",{props:{className:"bxcompprop-left"}}));var h=this.pLeftSide.appendChild(BX.create("DIV",{props:{className:"bxcompprop-l-top"}}));this.pSearchInput=h.appendChild(BX.create("INPUT",{props:{type:"text",className:"bxcompprop-search",placeholder:BX.message("CompParManSearch")}}));BX.bind(this.pSearchInput,"keyup",BX.proxy(this.SearchCheck,this));this.pGroupsIndex=this.pLeftSide.appendChild(BX.create("DIV",{props:{className:"bxcompprop-items-block"}}));BX.bind(this.pGroupsIndex,"click",BX.proxy(this.GoToGroup,this));this.pParamsCont=a.appendChild(BX.create("DIV",{props:{className:"bxcompprop-right"}}));var c=this.pParamsCont.appendChild(BX.create("DIV",{props:{className:"bxcompprop-title"}}));var d=c.appendChild(BX.create("SPAN",{props:{className:"bxcompprop-title-text"}}));this.pTitle=d.appendChild(BX.create("SPAN",{props:{className:"bxcompprop-title-text-lbl"},text:e.description.NAME}));this.pHelpIcon=d.appendChild(BX.create("SPAN",{props:{className:"bxcompprop-title-info-btn"}}));this.pHelpIcon.title=e.description.DESCRIPTION;this.pName=d.appendChild(BX.create("SPAN",{props:{className:"bxcompprop-title-description"},text:t.name}));var u=this.pParamsCont.appendChild(BX.create("DIV",{props:{className:"bxcompprop-content"}}));u.appendChild(BX.create("DIV",{props:{className:"bxcompprop-nothing-found"},text:BX.message("NoSearchResults")}));this.pParamsTable=u.appendChild(BX.create("TABLE",{props:{className:"bxcompprop-content-table"}}));this.pParamsWrap=u;BX.bind(this.pParamsWrap,"scroll",BX.proxy(this.CheckActiveGroup,this));var m,f,I,C;if(!e.groupIndex["COMPONENT_TEMPLATE"]&&e.templates.length>0){e.groups=[{ID:"COMPONENT_TEMPLATE",NAME:BX.message("TemplateGroup"),SORT:0}].concat(e.groups)}for(s=0;s<e.groups.length;s++){p=e.groups[s];m=BX.create("DIV",{props:{className:"bxcompprop-item"},attrs:{"data-bx-comp-group-id":p.ID},html:'<span class="bxcompprop-item-alignment"></span><span class="bxcompprop-item-text">'+BX.util.htmlspecialchars(p.NAME)+"</span>"});this.pGroupsIndex.appendChild(m);C=document.createDocumentFragment();I=BX.adjust(C.appendChild(BX.create("TR")),{props:{className:"bxcompprop-prop-tr"}});f=BX.adjust(I.insertCell(-1),{props:{className:"bxcompprop-cont-table-title",colSpan:2},text:p.NAME});this.groupIndex[p.ID]=e.groupIndex[p.ID]={group:p,frag:C,leftIndex:m,titleCell:f,titleRow:I,empty:p.ID!="COMPONENT_TEMPLATE"};if(s===0){this.SetActiveGroup(p.ID)}}if(e.templates.length>0){this.DisplayTemplateSelector(e.templates,t.template)}var x,T,P,b;if(t.currentValues["SEF_URL_TEMPLATES"]){T=t.currentValues["SEF_URL_TEMPLATES"];if(typeof T=="object"){P=T}else{P=this.GetArray(T.substr(0,8).toLowerCase()=="={array("?T.substr(2,T.length-3):T)}for(x in P){if(P.hasOwnProperty(x)){t.currentValues["SEF_URL_TEMPLATES_"+x]=P[x]}}delete t.currentValues["SEF_URL_TEMPLATES"]}if(t.currentValues["VARIABLE_ALIASES"]&&t.currentValues["SEF_MODE"]=="N"){T=t.currentValues["VARIABLE_ALIASES"];if(typeof T=="object"){b=T}else{b=this.GetArray(T.substr(0,8).toLowerCase()=="={array("?T.substr(2,T.length-3):T)}for(x in b){if(b.hasOwnProperty(x)){t.currentValues["VARIABLE_ALIASES_"+x]=b[x]}}delete t.currentValues["VARIABLE_ALIASES"]}for(s=0;s<e.parameters.length;s++){o=e.parameters[s];n=t.currentValues[o.ID];this.paramsIndex[o.ID]={param:o,value:n}}for(s=0;s<e.parameters.length;s++){o=e.parameters[s];n=t.currentValues[o.ID];o.TOOLTIP=e.tooltips[o.ID+"_TIP"]||"";if(!this.groupIndex[o.PARENT]){if(this.groupIndex["ADDITIONAL_SETTINGS"]){o.PARENT="ADDITIONAL_SETTINGS"}else if(this.groupIndex["BASE"]){o.PARENT="BASE"}}if(o.ID=="SEF_FOLDER"&&!o.DEFAULT&&t.relPath){o.DEFAULT=(t.relPath!="/"?t.relPath:"")+"/"}if(this.BuildComponentParameter(o,n,this.groupIndex[o.PARENT].frag)){this.groupIndex[o.PARENT].empty=false}}for(s=0;s<e.groups.length;s++){p=e.groups[s];if(this.groupIndex[p.ID].empty){this.groupIndex[p.ID].leftIndex.style.display="none";this.groupIndex[p.ID].titleRow.style.display="none"}else{this.pParamsTable.appendChild(this.groupIndex[p.ID].frag);this.lastTitle=this.groupIndex[p.ID].titleCell}}this.lastCell=BX.adjust(this.pParamsTable.appendChild(BX.create("TR")).insertCell(-1),{props:{className:"bxcompprop-last-empty-cell"},attrs:{colSpan:2}});window.scrollTo(l.scrollLeft,l.scrollTop);setTimeout(function(){window.scrollTo(l.scrollLeft,l.scrollTop);if(r.savedScrollTop){r.pParamsWrap.scrollTop=r.savedScrollTop;r.savedScrollTop=0}},50);BX.onCustomEvent(this,"onComponentParamsBuilt");return a},GoToGroup:function(e){var t=e.target||e.srcElement,a=t&&t.getAttribute?t.getAttribute("data-bx-comp-group-id"):null;if(!a){t=BX.findParent(t,function(e){return e.getAttribute&&e.getAttribute("data-bx-comp-group-id")},this.pGroupsIndex);a=t&&t.getAttribute?t.getAttribute("data-bx-comp-group-id"):null}if(a){this.pParamsWrap.scrollTop=this.groupIndex[a].titleCell.offsetTop;this.CheckActiveGroup(a)}},CheckActiveGroup:function(e){if(e&&this.groupIndex.hasOwnProperty(e)){this.SetActiveGroup(e)}else{var t,a,r=this.pParamsWrap.scrollTop;for(a in this.groupIndex){if(this.groupIndex.hasOwnProperty(a)&&!this.groupIndex[a].empty){t=this.groupIndex[a].titleCell.offsetTop;if(r>=t-10){this.SetActiveGroup(a)}}}}},SetActiveGroup:function(e){if(this.activeGroupId&&this.groupIndex[this.activeGroupId]){BX.removeClass(this.groupIndex[this.activeGroupId].leftIndex,"bxcompprop-item-active")}this.activeGroupId=e;BX.addClass(this.groupIndex[e].leftIndex,"bxcompprop-item-active");var t=this.groupIndex[e].leftIndex.offsetHeight+10,a=this.pGroupsIndex.scrollTop,r=this.pGroupsIndex.offsetHeight,s=this.groupIndex[e].leftIndex.offsetTop;if(a+r<s+t){this.pGroupsIndex.scrollTop=s+t-r}else if(s<a){this.pGroupsIndex.scrollTop=s}},CheckLastCell:function(){if(this.lastCell&&this.lastTitle){var e=this.pParamsWrap.offsetHeight,t=this.lastCell.offsetTop-this.lastTitle.offsetTop+10;this.lastCell.style.height=Math.max(e-t,0)+"px"}},Resize:function(e,t){var a=this.pLeftSide.offsetWidth,r=e-a-40;this.pContainer.style.width=e+"px";this.pContainer.style.height=t+"px";this.pParamsCont.style.width=r+"px";this.pParamsCont.style.height=t-12+"px";this.pParamsWrap.style.height=t-98+"px";this.pGroupsIndex.style.height=t-100+"px";this.pLeftSide.style.height=t-50+"px";this.CheckLastCell()},BuildComponentParameter:function(e,t,a){if(!e.TYPE){e.TYPE="STRING"}if(e.ID=="SEF_MODE"){e.TYPE="CHECKBOX"}e.TYPE=e.TYPE.toUpperCase();if(!e.ROWS){e.ROWS=0}e.MULTIPLE=(e.MULTIPLE&&e.MULTIPLE.toUpperCase())=="Y"?"Y":"N";if(typeof t=="string"&&t==="undefined"){t=undefined}var r=t;if(typeof t=="string"){if(this.IsPHPBracket(t)){t=this.TrimPHPBracket(t)}if(t.substr(0,6).toLowerCase()=="array("){t=this.ConvertStringToArray(t,true)}else if(e.TYPE=="LIST"){if(t!==r)t=[r];else t=[t]}else if(this.IsNum(t)){t=parseFloat(t)}else{t=r}}if(e.MULTIPLE=="Y"){e.CNT=parseInt(e.CNT,10);if(e.CNT<1){e.CNT=1}}var s=this.GetParamValueById("SEF_MODE");s=s&&s.toUpperCase()=="Y";if(s){if(e.ID.substr(0,16)=="VARIABLE_ALIASES")return false}else{if(e.ID.substr(0,17)=="SEF_URL_TEMPLATES")return false;if(e.ID=="SEF_FOLDER")return false;if(e.ID=="SEF_RULE")return false}e._propId=BX.util.htmlspecialchars(e.ID||Math.round(Math.random()*1e4))+"_"+this.id;if(e.HIDDEN&&e.HIDDEN.toString().toUpperCase()=="Y"&&t!==undefined){return this.DisplayHiddenParam(e,t,a)}var p=BX.adjust(a.appendChild(BX.create("TR")),{props:{className:"bxcompprop-prop-tr"}}),i=BX.adjust(p.insertCell(-1),{props:{className:"bxcompprop-cont-table-l"},html:'<label class="bxcompprop-label" for="'+e._propId+'">'+BX.util.htmlspecialchars(e.NAME||"")+":</label>"}),o=BX.adjust(p.insertCell(-1),{props:{className:"bxcompprop-cont-table-r"}});switch(e.TYPE){case"LIST":this.DisplayParamList(e,t,o);break;case"CHECKBOX":this.DisplayParamCheckbox(e,t,o);break;case"COLORPICKER":this.DisplayParamColorpicker(e,t,o);break;case"FILE":this.DisplayParamFile(e,t,o);break;case"TEMPLATES":this.DisplayParamTemplates(e,t,o);break;case"CUSTOM":this.DisplayParamCustom(e,t,o);break;default:this.DisplayParamString(e,t,o);break}if(e.TOOLTIP){new BX.CHint({hint:e.TOOLTIP,parent:o.appendChild(BX.create("I",{props:{className:"bxcompprop-info-btn"}}))})}this.searchIndex.push({content:e.ID.toLowerCase()+" "+(e.NAME||"").toLowerCase(),elementWrap:p,label:i.firstChild,name:e.NAME||"",groupId:e.PARENT||""});return true},DisplayParamList:function(e,t,a){e.SIZE=parseInt(e.SIZE,10);if(!e.SIZE){e.SIZE=e.MULTIPLE=="Y"?3:1}e.COLS=parseInt(e.COLS,10)||20;e.CNT=Math.max(parseInt(e.CNT),1)||1;if(t==undefined||t==["undefined"]){t=e.DEFAULT}if(typeof t=="object"){for(h=0;h<t.length;h++){if(t[h]==="undefined"||t[h]===undefined)t[h]=""}}if(!e.VALUES){e.VALUES=[]}e.ADDITIONAL_VALUES=(e.ADDITIONAL_VALUES&&e.ADDITIONAL_VALUES.toUpperCase())=="Y"?"Y":"N";var r=e._propId,s=this,p=false,i={},o,n,l,h,c=e.ID+(e.MULTIPLE=="Y"?"[]":""),d=BX.create("SELECT",{props:{size:e.SIZE,name:c,multiple:e.MULTIPLE=="Y",id:r},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}});d.onchange=BX.proxy(this.OnChageParams,this);if(e.VALUES["-"]){n="-";o=e.VALUES[n].toString();l=new Option(o,n,false,false);d.options.add(l)}for(n in e.VALUES){if(e.VALUES.hasOwnProperty(n)&&n!=="-"){o=e.VALUES[n].toString();l=new Option(o,n,false,false);d.options.add(l);if(e.ID=="COMPONENT_TEMPLATE"&&(n==t||n==".default"&&t==""||n==""&&t==".default")){this.SetOptionSelected(l,true);i[n]=true;p=true}else if(typeof t=="object"&&BX.util.in_array(n,t)){this.SetOptionSelected(l,true);i[n]=true;p=true}else if(typeof t=="string"&&n==t){this.SetOptionSelected(l,true);i[n]=true;p=true}}}a.appendChild(d);if(e.ADDITIONAL_VALUES=="Y"){l=new Option(e.MULTIPLE=="Y"?BX.message("CompParManNoValue"):BX.message("CompParManSelectOther"),"",!p,!p);d.options.add(l,0);if(!p)this.SetOptionSelected(l,true);var u=typeof t=="object"?t:[t];if(e.MULTIPLE=="Y"){for(n in u){if(!u.hasOwnProperty(n)||i[u[n]]||u[n]==""||u[n]==undefined){continue}a.appendChild(BX.create("BR"));if(e.ROWS>1){a.appendChild(BX.create("TEXTAREA",{props:{cols:e.COLS,name:c,value:u[n]},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(this.OnChageParams,this)}else{a.appendChild(BX.create("INPUT",{props:{size:e.COLS,name:c,value:u[n],type:"text"},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(this.OnChageParams,this)}}for(h=0;h<e.CNT;h++){a.appendChild(BX.create("BR"));if(e.ROWS>1){a.appendChild(BX.create("TEXTAREA",{props:{cols:e.COLS,name:c,value:""},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(this.OnChageParams,this)}else{a.appendChild(BX.create("INPUT",{props:{size:e.COLS,name:c,value:"",type:"text"},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(this.OnChageParams,this)}}var m=a.appendChild(BX.create("INPUT",{props:{type:"button",value:"+"},attrs:{"data-bx-property-id":e.ID},events:{click:function(){if(e.ROWS>1){a.appendChild(BX.create("TEXTAREA",{props:{cols:e.COLS,name:c,value:""},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(s.OnChageParams,s)}else{a.appendChild(BX.create("INPUT",{props:{size:e.COLS,name:c,value:"",type:"text"},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(s.OnChageParams,s)}a.appendChild(m)}}}))}else{var f;for(n in u){if(!u.hasOwnProperty(n)){continue}if(u[n]===undefined||u[n]==="undefined")u[n]="";a.appendChild(BX.create("BR"));if(e.ROWS>1){f=a.appendChild(BX.create("TEXTAREA",{props:{name:c+"_alt",value:i[u[n]]?"":u[n],disabled:p,cols:e.COLS},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}}));f.onchange=BX.proxy(this.OnChageParams,this)}else{f=a.appendChild(BX.create("INPUT",{props:{name:c+"_alt",value:i[u[n]]?"":u[n],disabled:p,size:e.COLS,type:"text"},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}}));f.onchange=BX.proxy(this.OnChageParams,this)}}if(f){BX.bind(d,"change",function(){f.disabled=d.value!=""})}}if(e.REFRESH=="Y"){a.appendChild(BX.create("INPUT",{props:{type:"button",value:"ok",className:"bxcompprop-ok-btn"},events:{click:BX.proxy(this.DoRefreshParams,this)}}));BX.addClass(a,"bxcompprop-cont-table-r-refreshed")}}},DisplayParamCheckbox:function(e,t,a){if(t!=undefined){t=t&&t.toUpperCase()=="Y"?"Y":"N"}else if(e.DEFAULT){t=e.DEFAULT.toUpperCase()=="Y"?"Y":"N"}else{t="N"}var r=e._propId,s=e.ID+(e.MULTIPLE=="Y"?"[]":""),p=BX.create("INPUT",{props:{type:"checkbox",name:s,checked:t=="Y",id:r},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}});p.onchange=BX.proxy(this.OnChageParams,this);a.appendChild(p);if(e.ID=="SEF_MODE"){e.REFRESH="Y"}},DisplayParamColorpicker:function(e,t,a){e.COLS=parseInt(e.COLS,10)||20;if(t==undefined){t=e.DEFAULT||""}var r=e._propId,s=this,p=a.appendChild(BX.create("INPUT",{props:{size:e.COLS,name:e.ID,value:t,type:"text",id:r},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true},style:{minWidth:"100px"}}));p.onchange=BX.proxy(this.OnChageParams,this);if(!this.Colorpicker){function i(e){i.superclass.constructor.apply(this,arguments)}BX.extend(i,BXColorPicker);i.prototype.BeforeCreate=function(){if(this.oPar.input){this.pWnd=this.oPar.input;BX.bind(this.oPar.input,"click",BX.proxy(this.OnClick,this))}};this.Colorpicker=i}var o=new this.Colorpicker({id:e.ID+"_colorpicker",input:p,zIndex:3100,OnSelect:function(t){p.value=t;s.OnChageParams(false,e.ID)}})},DisplayParamFile:function(e,t,a){e.COLS=parseInt(e.COLS,10)||20;if(t==undefined){t=e.DEFAULT||""}var r=e._propId,s=this,p=a.appendChild(BX.create("INPUT",{props:{size:e.COLS,name:e.ID,value:t,type:"text",id:r},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true},style:{minWidth:"70%"}}));p.onchange=BX.proxy(this.OnChageParams,this);if(e.FD_USE_MEDIALIB){var i=window["_bxMlBrowseButton_"+e.ID.toLowerCase()];var o=a.appendChild(BX.create("DIV",{props:{className:"bxcompprop-file-dialog-wrap"},html:""}));function n(){i=window["_bxMlBrowseButton_"+e.ID.toLowerCase()];if(!i)return;var t=BX.processHTML(i);setTimeout(function(){if(t.SCRIPT&&t.SCRIPT.length>0){var e,a="";for(var r=0;r<t.SCRIPT.length;r++){e=t.SCRIPT[r];if(e.isInternal){a+=";"+e.JS}}BX.evalGlobal(a)}},100);o.innerHTML=t.HTML;var a=BX("bx_fd_input_"+e.ID.toLowerCase());if(a){a.onclick=window["BX_FD_"+e.ID]}}if(!i)setTimeout(n,100);else n()}else{a.appendChild(BX.create("INPUT",{props:{type:"button",value:"..."},events:{click:window["BX_FD_"+e.ID]}}))}window["BX_FD_ONRESULT_"+e.ID]=function(t,a){if(typeof t=="object"){p.value=t.src}else{p.value=(a+"/"+t).replace(/\/\//gi,"/")}s.OnChageParams(false,e.ID)};if(e.REFRESH=="Y"){a.appendChild(BX.create("INPUT",{props:{type:"button",value:"ok",className:"bxcompprop-ok-btn"},events:{click:BX.proxy(this.DoRefreshParams,this)}}));BX.addClass(a,"bxcompprop-cont-table-r-refreshed")}},DisplayParamTemplates:function(e,t,a){e.COLS=parseInt(e.COLS,10)||20;e.CNT=1;e.MULTIPLE="N";var r=e._propId;if(t==undefined){t=e.DEFAULT||""}var s=a.appendChild(BX.create("INPUT",{props:{size:e.COLS,name:e.ID,value:t,type:"text",id:r},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}}));s.onchange=BX.proxy(this.OnChageParams,this);var p=[];for(var i in e.VALUES){if(e.VALUES.hasOwnProperty(i)){p[p.length]={text:e.VALUES[i].TEXT||"",title:e.VALUES[i].TITLE||"",onclick:function(e,t,a){function r(){if(a.PARAMETER_LINK&&a.PARAMETER_VALUE){e.SetParamValueById(a.PARAMETER_LINK,a.PARAMETER_VALUE)}var r=a.TEMPLATE;if(document.selection){t.focus();var s=document.selection.createRange();s.text=r}else if(t.selectionStart||t.selectionStart=="0"){var p=t.selectionStart;var i=t.selectionEnd;var o=p+r.length;t.value=t.value.substring(0,p)+r+t.value.substring(i,t.value.length);t.setSelectionRange(o,o);t.focus()}else{t.value+=r;t.focus()}BX.fireEvent(t,"change");t.focus()}return r}(this,s,e.VALUES[i])}}}if(p.length>0){var o=a.appendChild(BX.create("INPUT",{props:{type:"button",value:"..."}}));o.onclick=function(){BX.PopupMenu.show("mnu_"+r,o,p,{zIndex:5e3})}}},DisplayParamString:function(e,t,a){e.COLS=parseInt(e.COLS,10)||20;e.CNT=Math.max(parseInt(e.CNT),1)||1;var r,s,p=this,i=e._propId,o=e.ID+(e.MULTIPLE=="Y"?"[]":"");if(t==undefined){t=e.DEFAULT||""}if(e.MULTIPLE!="Y"){if(e.ROWS>1){a.appendChild(BX.create("TEXTAREA",{props:{cols:e.COLS,name:o,value:t,id:i},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(this.OnChageParams,this)}else{a.appendChild(BX.create("INPUT",{props:{size:e.COLS,name:o,value:t,type:"text",id:i},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(this.OnChageParams,this)}}else{for(r in t){if(!t.hasOwnProperty(r)||t[r]==""){continue}a.appendChild(BX.create("BR"));if(e.ROWS>1){a.appendChild(BX.create("TEXTAREA",{props:{cols:e.COLS,name:o,value:t[r]},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(this.OnChageParams,this)}else{a.appendChild(BX.create("INPUT",{props:{size:e.COLS,name:o,value:t[r],type:"text"},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(this.OnChageParams,this)}}for(s=0;s<e.CNT;s++){a.appendChild(BX.create("BR"));if(e.ROWS>1){a.appendChild(BX.create("TEXTAREA",{props:{cols:e.COLS,name:o,value:""},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(this.OnChageParams,this)}else{a.appendChild(BX.create("INPUT",{props:{size:e.COLS,name:o,value:"",type:"text"},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(this.OnChageParams,this)}}var n=a.appendChild(BX.create("INPUT",{props:{type:"button",value:"+"},attrs:{"data-bx-property-id":e.ID},events:{click:function(){if(e.ROWS>1){a.appendChild(BX.create("TEXTAREA",{props:{cols:e.COLS,name:o,value:""},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(p.OnChageParams,p)}else{a.appendChild(BX.create("INPUT",{props:{size:e.COLS,name:o,value:"",type:"text"},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}})).onchange=BX.proxy(p.OnChageParams,p)}a.appendChild(n)}}}))}if(e.REFRESH=="Y"){a.appendChild(BX.create("INPUT",{props:{type:"button",value:"ok",className:"bxcompprop-ok-btn"},events:{click:BX.proxy(this.DoRefreshParams,this)}}));BX.addClass(a,"bxcompprop-cont-table-r-refreshed")}},DisplayParamCustom:function(e,t,a){if(!e.JS_FILE||!e.JS_EVENT){return}if(t==undefined){t=e.DEFAULT||""}var r=e.ID+(e.MULTIPLE=="Y"?"[]":""),s=a.appendChild(BX.create("INPUT",{props:{type:"hidden",name:r,value:t,id:e._propId},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}}));s.onchange=BX.proxy(this.OnChageParams,this);function p(e){return function(){if(window[e.propertyParams.JS_EVENT]&&typeof window[e.propertyParams.JS_EVENT]=="function"){window[e.propertyParams.JS_EVENT](e)}}}var i=p({propertyID:e.ID,propertyParams:e,getElements:BX.proxy(this.GetNamedControls,this),oInput:s,oCont:a,data:e.JS_DATA||"",fChange:BX.proxy(this.OnChageParams,this)});BX.load([e.JS_FILE],i)},DisplayHiddenParam:function(e,t,a){var r=BX.adjust(a.appendChild(BX.create("TR")),{props:{className:"bxcompprop-prop-tr-hidden"}}),s=BX.adjust(r.insertCell(-1),{props:{colSpan:2}}),p=e._propId,i=e.ID+(e.MULTIPLE=="Y"?"[]":"");s.appendChild(BX.create("INPUT",{props:{name:i,value:t,type:"hidden",id:p},attrs:{"data-bx-property-id":e.ID,"data-bx-comp-prop":true}}))},DisplayTemplateSelector:function(e,t){var a,r={};for(a=0;a<e.length;a++){r[e[a].NAME]=e[a].DISPLAY_NAME||e[a].NAME}var s="TEMPLATE_"+this.id,p={ID:"COMPONENT_TEMPLATE",_propId:s,NAME:BX.message("TemplateGroup"),VALUES:r,REFRESH:"Y"},i=this.groupIndex["COMPONENT_TEMPLATE"].frag,o=BX.adjust(i.appendChild(BX.create("TR")),{props:{className:"bxcompprop-prop-tr"}}),n=BX.adjust(o.insertCell(-1),{props:{className:"bxcompprop-cont-table-l"},html:'<label class="bxcompprop-label" for="'+s+'">'+(p.NAME||"")+":</label>"}),l=BX.adjust(o.insertCell(-1),{props:{className:"bxcompprop-cont-table-r"}});this.paramsIndex[p.ID]={param:p,value:t};this.DisplayParamList(p,t,l);this.searchIndex.push({content:"template "+(p.NAME||"").toLowerCase(),elementWrap:o,label:n.firstChild,name:p.NAME||"",groupId:p.PARENT||""})},GetTemplateValue:function(){var e=BX("TEMPLATE_"+this.id);if(e)return e.value==".default"?"":e.value;return""},DoRefreshParams:function(){BX.onCustomEvent(this,"onComponentParamsBeforeRefresh");var e=this;setTimeout(function(){e.params.currentValues=e.GetParamsValues();e.params.template=e.GetTemplateValue();e.savedScrollTop=e.pParamsWrap.scrollTop;e.GetComponentParams(e.params)},1)},SetOptionSelected:function(e,t){setTimeout(function(){e.selected=t},1)},OnChageParams:function(e,t){if(e&&!t){var a=e.target||e.srcElement;t=a.getAttribute("data-bx-property-id")}if(t&&this.paramsIndex[t]){var r=this.paramsIndex[t];if(r.param.REFRESH=="Y"){this.DoRefreshParams()}}},GetParamsValues:function(){var e=this.params.currentValues||{},t,a,r,s,p={},i,o,n=this.GetControls();for(t=0;t<n.length;t++){a=n[t];r=a.getAttribute("data-bx-property-id");if(a.disabled||!this.paramsIndex[r])continue;i=this.paramsIndex[r].param;if(i.MULTIPLE=="Y"){if(!p[i.ID]){p[i.ID]=[]}if(a.nodeName.toUpperCase()=="SELECT"&&a.multiple){for(o in a.options){if(a.options.hasOwnProperty(o)&&a.options[o].selected){p[i.ID].push(a.options[o].value)}}}else{p[i.ID].push(a.value)}}else if(i.TYPE=="CHECKBOX"){p[i.ID]=a.checked?"Y":"N"}else{p[i.ID]=a.value}}for(r in p){if(p.hasOwnProperty(r)){s=p[r];if(s==="undefined"||s===undefined){e[r]=""}else{e[r]=typeof s=="object"?this.WrapPHPBrackets(this.ConvertArrayToString(s)):s}}}if(e.COMPONENT_TEMPLATE)delete e.COMPONENT_TEMPLATE;return e},GetControls:function(){if(this.params.container)return BX.findChildren(this.params.container,{attr:{"data-bx-comp-prop":true}},true);return[]},GetNamedControls:function(){var e,t,a={},r,s,p=this.GetControls();for(e=0;e<p.length;e++){t=p[e];r=t.getAttribute("data-bx-property-id");if(r&&this.paramsIndex[r]){s=this.paramsIndex[r].param;a[s.ID]=t}}return a},GetParamValueById:function(e){var t="",a=this.paramsIndex[e];if(a&&a.value){t=a.value}else if(a&&a.param&&a.param.DEFAULT!=undefined){t=a.param.DEFAULT}return t},SetParamValueById:function(e,t){var a=this.paramsIndex[e];if(a){var r=BX(a.param._propId);if(r&&r.type.toLowerCase()=="text"){r.value=t;BX.fireEvent(r,"change")}}},IsPHPBracket:function(e){return e.substr(0,2)=="={"},TrimPHPBracket:function(e){return e.substr(2,e.length-3)},TrimQuotes:function(e,t){var a,r;e=e.trim();if(t==undefined){a=e.substr(0,1);r=e.substr(0,1);if(a=='"'&&r=='"'||a=="'"&&r=="'"){e=e.substring(1,e.length-1)}}else{if(!t.length){return e}a=e.substr(0,1);r=e.substr(0,1);t=t.substr(0,1);if(a==t&&r==t){e=e.substring(1,e.length-1)}}return e},WrapPHPBrackets:function(e){e=e.trim();var t=e.substr(0,1),a=e.substr(0,1);if(t=='"'&&a=='"'||t=="'"&&a=="'"){return e}return"={"+e+"}"},IsNum:function(e){var t=e;e=parseFloat(t);if(isNaN(e)){e=parseInt(t)}return!isNaN(e)?t===e:false},ConvertArrayToString:function(e){var t=[];var a="array(";for(var r in e){if(e.hasOwnProperty(r)&&e[r]!=="undefined"&&e[r]!==undefined){if(isNaN(parseInt(r))||parseInt(r)!=r){t.push('"'+r+'" => "'+e[r]+'"')}else{t[r]='"'+e[r]+'"'}}}a+=t.join(", ");a+=")";return a},ConvertStringToArray:function(e,t){var a=this.GetArray(e),r=true,s=[],p={},i;for(i in a){if(a.hasOwnProperty(i)){if(i!==""&&typeof a[i]!="function"&&(a[i]!==""||!t)){if(i!=parseInt(i)){r=false}if(r){s.push(a[i])}p[i]=a[i]}}}return r?s:p},GetArray:function(e){var t={};if(e.substr(0,6).toLowerCase()!="array("){return e}e=e.substring(6,e.length-1);var a=this.GetParams(e),r,s;for(var p=0;p<a.length;p++){if(a[p].substr(0,6).toLowerCase()=="array("){t[p]=this.GetArray(a[p]);continue}var i=a[p].indexOf("=>");if(i==-1){if(a[p]==this.TrimQuotes(a[p])){t[p]=this.WrapPHPBrackets(a[p])}else{t[p]=this.TrimQuotes(a[p])}}else{r=this.TrimQuotes(a[p].substr(0,i));s=a[p].substr(i+2);if(s==this.TrimQuotes(s)){s=this.WrapPHPBrackets(s)}else{s=this.TrimQuotes(s)}if(s.substr(0,6).toLowerCase()=="array("){s=this.getArray(s)}t[r]=s}}return t},GetParams:function(e){var t,a=[],r=0,s,p,i=1,o=1,n="";for(t=0;t<e.length;t++){s=e.substr(t,1);if(s=='"'&&o==1&&!p){i*=-1}else if(s=="'"&&i==1&&!p){o*=-1}else if(s=="\\"&&!p){p=true;n+=s;continue}if(p)p=false;if(o==-1||i==-1){n+=s;continue}if(s=="("){r++}else if(s==")"){r--}else if(s==","&&r==0){a.push(n);n="";continue}if(r<0)break;n+=s}if(n!="")a.push(n);return a},SearchCheck:function(e){var t=this.pSearchInput.value;if(e.keyCode==27){this.pSearchInput.value="";BX.defer(this.ClearSearchResult,this)()}else{if(t.length<2){this.ClearSearchResult()}else{this.Search(t)}}},Search:function(e){this.ClearSearchResult();var t=false,a=this,r,s,p,i,o=this.searchIndex.length;e=BX.util.trim(e.toLowerCase());BX.addClass(this.pGroupsIndex,"bxcompprop-groups-search");BX.addClass(this.pParamsWrap,"bxcompprop-params-search");for(i=0;i<o;i++){s=this.searchIndex[i];if(s.content.indexOf(e)!==-1){t=true;BX.addClass(s.elementWrap,"bxcompprop-tr-search-res");this._searchResult.push(s.elementWrap);if(s.name&&s.name.toLowerCase().indexOf(e.toLowerCase())!==-1&&s.label&&s.label.parentNode&&s.label.parentNode.parentNode){this.HighlightLabel(s.label,e,s.name)}p=this.groupIndex[s.groupId];if(p){BX.addClass(p.leftIndex,"bxcompprop-item-search-res");this._searchResultSect.push(p.leftIndex);BX.addClass(p.titleRow,"bxcompprop-tr-search-res");this._searchResult.push(p.titleRow)}}}if(!t){BX.addClass(this.pContainer,"bxcompprop-no-search-results")}this.bSearchCleared=false;var n=BX.WindowManager.Get();if(n){n.unclosable=true}},ClearSearchResult:function(){BX.removeClass(this.pGroupsIndex,"bxcompprop-groups-search");BX.removeClass(this.pParamsWrap,"bxcompprop-params-search");BX.removeClass(this.pContainer,"bxcompprop-no-search-results");var e;if(this._searchResult){for(e=0;e<this._searchResult.length;e++){BX.removeClass(this._searchResult[e],"bxcompprop-tr-search-res")}this._searchResult=[]}if(this._searchResultSect){for(e=0;e<this._searchResultSect.length;e++){BX.removeClass(this._searchResultSect[e],"bxcompprop-item-search-res")}this._searchResultSect=[]}if(this._searchResultLabel){for(e=0;e<this._searchResultLabel.length;e++){this._searchResultLabel[e].node.innerHTML=BX.util.htmlspecialchars(this._searchResultLabel[e].name)+":"}this._searchResultSect=[]}this.bSearchCleared=true;var t=BX.WindowManager.Get();if(t){t.unclosable=false}},HighlightLabel:function(e,t,a){e.innerHTML=BX.util.htmlspecialchars(a).replace(new RegExp("("+t+")","ig"),"<i>$1</i>")+":";this._searchResultLabel.push({node:e,name:a})}};function t(){top.BXComponentParamsManager=window.BXComponentParamsManager=e}if(!top.BXComponentParamsManager)t()})();
//# sourceMappingURL=component_params_manager.map.js